package fr.umlv.m2.uwp2011.persistence.sujet;

import java.io.Serializable;
import java.util.Iterator;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@SuppressWarnings("serial")
@Entity
@Table(name="SUJET")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="TYPE_SUJET", discriminatorType=DiscriminatorType.STRING)
public class Sujet implements Serializable {
	
	@Id
	@GeneratedValue
	@Column(name="SUJET_ID")
	private Long id;
	
	@Column(name="SUJET_TYPE")
	private String type;
	
	@Column(name="SUJET_TITRE")
	private String titre;
	
	@Column(name="SUJET_DESCRIPTION")
	private String description;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "sujet")
	private List<Link> links;
	
	
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getTitre() {
		return titre;
	}

	public void setTitre(String titre) {
		this.titre = titre;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Long getId() {
		return id;
	}

	public void setLinks(List<Link> links) {
		this.links = links;
	}

	public Iterator<Link> iteratorLinks() {
		return links.iterator();
	}
}
